import Vue from 'vue'
import Router from 'vue-router'

import PagesView from '../view/PagesView'
import HomeView from '../view/HomeView'
import MovieView from '../view/MovieView'
import BookView from '../view/BookView'
import LoginView from '../view/LoginView'
import RegisterView from '../view/RegisterView'
import NewsView from '../view/NewsView'
import SearchView from '../view/SearchView'
import DetailView from '../view/DetailView'
import GroupView from '../view/GroupView'


Vue.use(Router)

export default new Router({ //配置路由
  routes: [
    {
      path: '/',
      redirect: '/pages'
    },{ //内嵌路由
      path: '/pages',
      component: PagesView, 
      children: [
        {
          path: '',
          redirect: '/pages/home'
        }, {
          path: 'home',
          name: 'HomeView',
          component: HomeView
        }, {
          path: 'movie',
          name: 'MovieView',
          component: MovieView
        }, {
          path: 'book',
          name: 'BookView',
          component: BookView
        }, {
          path: 'news',
          name: 'NewsView',
          component: NewsView
        }, {
          path:　'group',
          name: 'GroupView',
          component: GroupView
        },{
          path: 'detail/:id',
          name: 'DetailView',
          component: DetailView
        }
      ]
    }, {
      path: '/login',
      name: 'LoginView',
      component: LoginView
    }, {
      path: '/register',
      name: 'RegisterView',
      component: RegisterView
    }, {
      path: '/search',
      name: 'SearchView',      
      components: {
        default: PagesView,
        search: SearchView
      }
    }
    
  ]
})
